home *** CD-ROM | disk | FTP | other *** search
- /* Grapevine FAQ script v1.0
- Only works on Grapevine 2 ßeta versions (ie v1.365)
- Needs standard AmigaDOS list, sort, and delete commands to work 100%
- Assign a directory FAQ: containing your faq files
- /Alias faq faq.gv to use the /faq command in gv (add to startup.gv)
- @
- Grapevine FAQ command help:
- Usage: /faq file [nick] - Leave off [nick] to send to channel
- or /faq command arg - See below for details on each command
- ADD <faqname> <faqtext> - Adds a faq to your list
- DEL <faqname> - Deletes a faq named <faqname>
- UNDEL <faqname> - Restores deleted faq to <faqname>
- REN <faqname> <newname> - Renames <faqname> to <newname>
- LIST - Lists all of your faqs in order
- LIST # - Lists faqs to the current channel
- LIST [nick] - Lists faq to [nick]
- VIEW <faqname> - Views a faq locally (not to channel)
- EDIT <faqname> [editor] - Uses <editor> to edit <faqname>
- - set to your default editor in source
- @
- Maximum length is 512 characters.. change it if you think its safe :)
- Written by Josef Faulkner (panther@gate.net) IRC: Josef on June 14 1995
- */
- /** Change this if you dont want to type in the editor every time **/
- /** ------------------------------------------------------------- **/
- /**/ EditorDefault = 'Ed' /**/
- /** ------------------------------------------------------------- **/
- options results
- parse arg faq name faqtext
- bb=''
- uu=''
- ii=''
- faq=strip(faq)
- name=strip(name)
- faqtext=strip(faqtext)
- if upper(faq)='ADD' then do
- if exists('FAQ:'name) then do
- 'echo 'bb||name||bb' FAQ already exists.'
- 'echo Use 'bb'/FAQ DEL <faqname>'bb' to remove it.'
- end
- else do
- call open(1,'FAQ:'name,w)
- call writeln(1,faqtext)
- call close(1)
- 'echo 'bb||name||bb' added. Use 'bb'/FAQ view 'name||bb' to see it without sending.'
- end
- end
- else if upper(faq)='DEL' then do
- if exists('FAQ:'name) then do
- address command 'copy faq:'name' faq:BAK'
- address command 'delete faq:'name
- 'echo 'bb||name||bb' deleted. It has been backed up to 'uu'FAQ:BAK'uu
- end
- else do
- 'echo 'bb||name||bb' not found.'
- end
- end
- else if upper(faq)='UNDEL' then do
- faqtext=word(faqtext,1)
- if exists('FAQ:BAK') then do
- address command 'copy faq:bak faq:'faqtext
- 'echo Backup faq restored to 'bb||faqtext||bb'.'
- end
- else do
- 'echo No backup exists.'
- end
- end
- else if upper(faq)='LIST' then do
- address command 'list FAQ:~(BAK) lformat %n >T:faq.list'
- address command 'sort T:faq.list T:faq.list.sorted'
- address command 'delete T:faq.list'
- if exists('T:faq.list.sorted') then do
- call open(1,'T:faq.list.sorted',r)
- outtext=uu'FAQ List:'uu' '
- do until eof(1)
- text=strip(readln(1))
- outtext=outtext' 'text
- end
- outtext=left(outtext,512)
- if upper(name)='#' then do
- 'say 'outtext
- end
- else if upper(name)='' then do
- 'echo 'outtext
- end
- else do
- 'msg 'name' 'outtext
- end
- call close(1)
- address command 'delete t:faq.list.sorted'
- end
- else 'echo No FAQ''s exist.'
- end
- else if upper(faq)='EDIT' then do
- if exists('faq:'name) then do
- if faqtext='' then faqtext=editordefault
- address command 'run 'faqtext' faq:'name
- end
- else do
- 'echo 'bb||name||bb' doesnt exist.'
- end
- end
- else if upper(faq)='VIEW' then do
- if exists('faq:'name) then do
- call open(1,'FAQ:'name,r)
- outtext='FAQ ('name'): '
- do until eof(1)
- text=strip(readln(1))
- outtext=outtext' 'text
- end
- outtext=left(outtext,512)
- 'echo 'outtext
- call close(1)
- end
- else do
- 'echo 'bb||faq||bb' not found.'
- end
- end
- else if upper(faq)='REN' then do
- if exists('faq:'name) then do
- if exists('faq:'faqtext)=0 then do
- address command 'rename faq:'name' faq:'faqtext
- 'echo 'bb||name||bb' renamed to 'bb||faqtext||bb'.'
- end
- else do
- 'echo Attempt to rename to existing file: 'bb||faqtext||bb' already exists.'
- end
- end
- else do
- 'echo 'bb||name||bb' does not exist.'
- end
- end
- else if upper(faq)='HELP' then do
- send=0
- if exists('faq.gv') then do
- call open(1,'faq.gv')
- do until eof(1)
- text=readln(1)
- if text='@' then send=1-send
- else if send then 'echo 'strip(text,b,' ')
- end
- end
- else if exists('SYS:rexx/faq.gv') then do
- call open(1,'SYS:rexx/faq.gv')
- do until eof(1)
- text=readln(1)
- if text='@' then send=1-send
- else if send then 'echo 'strip(text,b,' ')
- end
- end
- else do
- 'echo Could not find arexx program in current directory.'
- end
- end
- else do
- if exists('faq:'faq) then do
- call open(1,'FAQ:'faq,r)
- outtext='FAQ ('faq'): '
- do until eof(1)
- text=strip(readln(1))
- outtext=outtext' 'text
- end
- outtext=left(outtext,512)
- if name~='' then do
- msg name outtext
- end
- else do
- 'say 'outtext
- end
- call close(1)
- end
- else do
- 'echo 'bb||faq||bb' not found.'
- end
- end
- exit
-